/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package origendatos.dyd.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author erodrig
 */
@Entity
@Table(name = "CARACTERISTICAS")
@NamedQueries({
    @NamedQuery(name = "Caracteristicas.findAll", query = "SELECT c FROM Caracteristicas c"),
    @NamedQuery(name = "Caracteristicas.findByNombre", query = "SELECT c FROM Caracteristicas c WHERE c.nombre = :nombre"),
    @NamedQuery(name = "Caracteristicas.findByAbreviatura", query = "SELECT c FROM Caracteristicas c WHERE c.abreviatura = :abreviatura")})
public class Caracteristicas implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @Column(name = "NOMBRE", nullable = false, length = 20)
    private String nombre;
    @Id
    @Basic(optional = false)
    @Column(name = "ABREVIATURA", nullable = false, length = 3)
    private String abreviatura;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "caracteristicas")
    private List<CaracteristicasPj> caracteristicasPjList;

    public Caracteristicas() {
    }

    public Caracteristicas(String abreviatura) {
        this.abreviatura = abreviatura;
    }

    public Caracteristicas(String abreviatura, String nombre) {
        this.abreviatura = abreviatura;
        this.nombre = nombre;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getAbreviatura() {
        return abreviatura;
    }

    public void setAbreviatura(String abreviatura) {
        this.abreviatura = abreviatura;
    }

    public List<CaracteristicasPj> getCaracteristicasPjList() {
        return caracteristicasPjList;
    }

    public void setCaracteristicasPjList(List<CaracteristicasPj> caracteristicasPjList) {
        this.caracteristicasPjList = caracteristicasPjList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (abreviatura != null ? abreviatura.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Caracteristicas)) {
            return false;
        }
        Caracteristicas other = (Caracteristicas) object;
        if ((this.abreviatura == null && other.abreviatura != null) || (this.abreviatura != null && !this.abreviatura.equals(other.abreviatura))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "origendatos.dyd.model.Caracteristicas[abreviatura=" + abreviatura + "]";
    }

}
